<!DOCTYPE html>
<html lang="zh-CN">
<head>
    //@ include("/inc/head.html"){}
    <title>用户信息</title>
</head>
<body>

//@ include("/shiro/top.html"){}

<div class="container">

    //@ if(isNotEmpty(errMsg)){
    <div class="alert alert-danger" role="alert">${errMsg!}</div>
    //@ }

    <ol class="breadcrumb">
        <li><a href="${ctxPath}/shiro/main">权限管理</a></li>
        <li><a href="${ctxPath}/shiro/role/list">用户管理</a></li>
        <li class="active">
            //@ if(action=='insert'){print('新增用户');}else{print('修改用户');}
        </li>
    </ol>

    <form class="form-horizontal" method="post" action="${ctxPath}/shiro/user/${action}">
        <div class="form-group" style="display: none;">
            <label class="col-sm-2 control-label">ID</label>
            <div class="col-sm-10">
                <input class="form-control" name="user.id" value="${user.id!}" placeholder="ID" readonly required/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">姓名</label>
            <div class="col-sm-10">
                <input class="form-control" name="user.name" value="${user.name!}" placeholder="名称" required autofocus/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">所属角色</label>
            <div class="col-sm-10">
                <select class="form-control" name="roleIds" multiple required>
                    //@ for(r in roles){
                    <option value="${r.id}">${r.name}</option>
                    //@ }
                </select>
                <script>$('select[name="roleIds"]').select2({closeOnSelect: true});</script>
                //@ if(isNotEmpty(roleIds)){
                <script>$('select[name="roleIds"]').val(${roleIds}).trigger("change");</script>
                //@ }
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">登陆名称</label>
            <div class="col-sm-10">
                <input class="form-control" name="user.loginName" value="${user.loginName!}" placeholder="登陆名称"
                       required/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-2 control-label">登陆密码</label>
            <div class="col-sm-10">
                <input class="form-control" name="user.loginPassword" value="${user.loginPassword!}" placeholder="登陆密码"
                       required type="password"/>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default">提交</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>